Skip to content

Conversation

@joashc
Copy link

@joashc joashc commented Oct 24, 2014

Fixed Issue #3, and a few other issues preventing the unit tests from passing.

Before these changes, we get the You can only make functions into Conduits error, as mentioned in Issue #3.

> [email protected] test
> mocha ./spec/*.js
6 failing

    1) postal.when when calling when with default behavior "before all" hook:
       Error: You can only make functions into Conduits.
    2) postal.when when calling when with default behavior "after all" hook:
       TypeError: Cannot call method 'dispose' of undefined
    3) postal.when when calling when with once = true "before all" hook:
       Error: You can only make functions into Conduits.
    4) postal.when when calling when with once = true "after all" hook:
       TypeError: Cannot call method 'dispose' of undefined
    5) postal.when when calling when with a timeout that triggers onError The onError callback should be invoked:
       Error: You can only make functions into Conduits.
    6) postal.when when calling when with a timeout that does NOT trigger onError data should match expected:
       Error: You can only make functions into Conduits.

npm ERR! Test failed.  See above for more details.

After adding no-op callbacks for subscriptions with undefined callbacks, and fixing a few other minor issues, all unit tests pass:

> [email protected] test
> mocha ./spec/*.js

  postal.when
      when calling when with default behavior
         ✓ should invoke the callback the expected number of times 
         ✓ data_a should match expected 
         ✓ data_b should match expected 
         ✓ data_c should match expected 
         ✓ data_d should match expected 
      when calling when with once = true
         ✓ should only invoke the callback once 
         ✓ data_a should match expected 
         ✓ data_b should match expected 
         ✓ data_c should match expected 
         ✓ data_d should match expected 
      when calling when with a timeout that triggers onError
         ✓ The onError callback should be invoked 
      when calling when with a timeout that does NOT trigger onError
         ✓ data should match expected (1111ms)

12 passing (1s)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"You can only make functions into Conduits."

1 participant